import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

import 'package:zhongyiapp/pages/index.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Userscreen(),
    );
  }
}

class Userscreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Stack(children: [
      Image.asset(
        'assets/背景图1.png',
        fit: BoxFit.cover,
        width: double.infinity,
        height: double.infinity,
      ),
      Column(children: const [
        title(),
        SizedBox(
          height: 10.0,
        ),
        RowItem1(),
        SizedBox(
          height: 10.0,
        ),
        RowItem2(),
        SizedBox(
          height: 10.0,
        ),
        RowItem3(),
        SizedBox(
          height: 10.0,
        ),
        RowItem4(),
        SizedBox(
          height: 10.0,
        ),
        RowItem5()
      ])
    ]));
  }
}

class title extends StatelessWidget {
  const title({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
        width: 420,
        height: 230,
        decoration: BoxDecoration(color: Color.fromARGB(128, 191, 164, 124)),
        child: Column(children: <Widget>[
          SizedBox(
            height: 10.0,
          ),
          ListTile(
            leading: GestureDetector(
              onTap: () {
                // 跳转到目标页面
                Navigator.push(
                  context,
                  MaterialPageRoute(builder: (context) => Indexscreen()),
                );
              },
              child: Icon(
                Icons.arrow_back_ios,
                size: 25.0,
                color: Colors.white,
              ),
            ),
            title: Text(
              '个人中心',
              textAlign: TextAlign.center,
              style: TextStyle(fontSize: 25.0, color: Colors.white),
            ),
          ),
          SizedBox(
            height: 15.0,
          ),
          Container(
              width: 380,
              height: 130,
              decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(16.0)),
              child: Row(
                children: <Widget>[
                  SizedBox(
                    width: 10.0,
                  ),
                  // 头像
                  CircleAvatar(
                    radius: 45.0,
                    backgroundImage: AssetImage('assets/头像.png'), // 替换为你的头像图片路径
                  ),
                  SizedBox(width: 16.0), // 头像和文字之间的间距

                  // 两行文字
                  Expanded(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        SizedBox(
                          height: 35.0,
                          width: 10.0,
                        ),
                        Text(
                          '中医小助手',
                          style: TextStyle(
                              fontSize: 18.0, fontWeight: FontWeight.bold),
                        ),
                        SizedBox(height: 8.0), // 两行文字之间的间距
                        Text(
                          '编写个人资料',
                          style: TextStyle(fontSize: 16.0),
                        ),
                      ],
                    ),
                  ),

                  SizedBox(width: 16.0), // 文字和二维码之间的间距

                  // 二维码
                  Image.asset(
                    'assets/二维码.png',
                    width: 70.0,
                    height: 70.0,
                  ),
                  SizedBox(
                    width: 15.0,
                  )
                ],
              ))
        ]));
  }
}

class RowItem1 extends StatelessWidget {
  const RowItem1({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(16.0),
      child: Row(
        children: <Widget>[
          // 左边图标
          Icon(
            Icons.message,
            size: 35.0,
          ),

          // 文本
          SizedBox(width: 20.0), // 图标和文本之间的间距
          Expanded(
            child: Text(
              '我的消息',
              style: TextStyle(fontSize: 27.0, color: Colors.black),
            ),
          ),

          // 右箭头图标
          SizedBox(width: 8.0), // 文本和箭头之间的间距
          Icon(
            Icons.arrow_forward,
            size: 35.0,
          ),
        ],
      ),
    );
  }
}

class RowItem2 extends StatelessWidget {
  const RowItem2({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(16.0),
      child: Row(
        children: <Widget>[
          // 左边图标
          Icon(
            Icons.favorite,
            size: 35.0,
          ),

          // 文本
          SizedBox(width: 20.0), // 图标和文本之间的间距
          Expanded(
            child: Text(
              '我的收藏',
              style: TextStyle(fontSize: 27.0, color: Colors.black),
            ),
          ),

          // 右箭头图标
          SizedBox(width: 8.0), // 文本和箭头之间的间距
          Icon(
            Icons.arrow_forward,
            size: 35.0,
          ),
        ],
      ),
    );
  }
}

class RowItem3 extends StatelessWidget {
  const RowItem3({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(16.0),
      child: Row(
        children: <Widget>[
          // 左边图标
          Icon(
            Icons.account_circle,
            size: 35.0,
          ),

          // 文本
          SizedBox(width: 20.0), // 图标和文本之间的间距
          Expanded(
            child: Text(
              '个人资料',
              style: TextStyle(fontSize: 27.0, color: Colors.black),
            ),
          ),

          // 右箭头图标
          SizedBox(width: 8.0), // 文本和箭头之间的间距
          Icon(
            Icons.arrow_forward,
            size: 35.0,
          ),
        ],
      ),
    );
  }
}

class RowItem4 extends StatelessWidget {
  const RowItem4({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(16.0),
      child: Row(
        children: <Widget>[
          // 左边图标
          Icon(
            Icons.navigation,
            size: 35.0,
          ),

          // 文本
          SizedBox(width: 20.0), // 图标和文本之间的间距
          Expanded(
            child: Text(
              '我的足迹',
              style: TextStyle(fontSize: 27.0, color: Colors.black),
            ),
          ),

          // 右箭头图标
          SizedBox(width: 8.0), // 文本和箭头之间的间距
          Icon(
            Icons.arrow_forward,
            size: 35.0,
          ),
        ],
      ),
    );
  }
}

class RowItem5 extends StatelessWidget {
  const RowItem5({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(16.0),
      child: Row(
        children: <Widget>[
          // 左边图标
          Icon(
            Icons.settings,
            size: 35.0,
          ),

          // 文本
          SizedBox(width: 20.0), // 图标和文本之间的间距
          Expanded(
            child: Text(
              '用户设置',
              style: TextStyle(fontSize: 27.0, color: Colors.black),
            ),
          ),

          // 右箭头图标
          SizedBox(width: 8.0), // 文本和箭头之间的间距
          Icon(
            Icons.arrow_forward,
            size: 35.0,
          ),
        ],
      ),
    );
  }
}
